proc msg:sndnote {nick host handle arg} {
  global botnick home
  set argument [lindex $arg 0]

  # If user is sending a note to a channel
  if {[string match "#*" $argument] && [validchan $argument]} {
    set chan $argument
    set otbn1 [lindex $arg 1]
    set botnet2 [lrange $arg 2 end]
  } else {
    set chan $home
    set otbn1 [lindex $arg 0]
    set botnet2 [lrange $arg 1 end]
  }

  # if the user has accesss...
  if {![matchattr $handle o|v $chan] && ![matchattr $handle o|o $chan]} {
    putquick "NOTICE $nick :\0034ERROR - Permission Denied."
    return 0
  }

  if {![matchattr $handle A]} {
    putquick "NOTICE $nick :\0034ERROR - You need to authenticate first."
    putquick "NOTICE $nick :\00312You may authenticate yourself by typing \0033\002/msg $botnick auth <your password>\002"
    return 0
  }

  if {[matchattr $handle D]} {
    putquick "NOTICE $nick :\0034ERROR - Permission Denied - Access Is Disabled."
    return 0
  }

  sndnote $nick $handle $otbn1 $botnet2 $host $chan
  return 0
}










